<?php
//获取系统菜单中的一级菜单
function menu(){
    $menu = M('menu')->where('pid=0')->order('sort asc')->select();
    return $menu;
}
//根据当前菜单查询子菜单
function child_menu($menu_id){
    $now_menu = M('menu')->where('id='.$menu_id)->find();
    $child_menu = M('menu')->where('pid='.$menu_id)->order('sort asc')->select();
    if(LANG_SET=='zh-cn'){
        $now_menu=$now_menu['name'];
    }else{
        $now_menu=$now_menu['name_us'];
    }
    $res = array(
        'menu_id'=>$menu_id,
        'menu_name'=>$now_menu,
        'child_menu'=>$child_menu
    );
    return $res;
}